<?php echo doctype('html5'); ?>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="document-type" content="Web Page" />
        <meta http-equiv="imagetoolbar" content="no" />
        
        <meta name="HandheldFriendly" content="True">
        <meta name="MobileOptimized" content="320">
        <meta name="viewport" content="width=device-width">
	<meta http-equiv="cleartype" content="on">
        
        <title>
            <?php echo str_replace(array('%s', '%p'), array($this->config->item('site_name'), $pagetitle), $this->config->item('pagetitle')); ?>
        </title>
        
        <?php echo output_ui(); ?>
        
    </head>
    
    <body class="<?php echo strtolower(get_browser_name()); ?><?php echo is_browser('MSIE') ? ' ie-'.browser_version(true) : null; ?>">
            
        <div id="header_wrapper">
            <div id="header_btm_wrapper"></div>
            <noscript>
                <div id="nojs_wrapper">
                    <div id="nojs_inner">
                        <h3><?php echo $this->lang->line('no_js_header'); ?></h3>
                        <?php echo $this->lang->line('no_js_msg', array('%s' => $this->config->item('site_name'))); ?>
                    </div>
                </div>
            </noscript>
            
            {* Show IE 8 or less warnings *}
            <?php if(is_browser('MSIE') && browser_version(true) < 9) : ?>
                <div id="ie_warning">
                    <?php echo $this->lang->line('ie_warning', array('%v' => browser_version(true))); ?>
                </div>
            <?php endif; ?>

            {* List connections *}
            <div id="connections_wrapper">
                <div id="logo_wrapper">
                    <a href="<?php echo site_url(); ?>">
                        <img src="<?php echo interface_url('/img/logo_small.png'); ?>" alt="<?php echo $this->config->item('site_name'); ?>" title="<?php echo $this->config->item('site_name'); ?>" id="vanilladb_logo" />
                    </a>
                </div>

                <ul id="connections_inner">
                    <?php if(count($connections) > 0) : ?>
                        <?php foreach($connections as $connection_id => $connection) : ?>
                            <li class="select_connection <?php echo $connection['type']; ?><?php echo $connection['selected'] ? ' selected' : ''; ?>">
                                <?php if(array_key_exists($connection['type'], $all_db_types)) : ?>
                                    <div class="db_icon" title="<?php echo $all_db_types[$connection['type']]; ?>"></div>
                                <?php endif; ?>
                                <a href="<?php echo $connection['url']; ?>" class="connection_name"><?php echo $connection['name']; ?></a>
                                <a href="<?php echo close_connection($connection_id); ?>" id="connection_<?php echo $connection_id; ?>" class="close_connection" title="<?php echo $this->lang->line('close_connection'); ?>"></a>
                            </li>
                        <?php endforeach; ?>
                    <?php endif; ?>
                    <li id="new_connection"<?php if($new_connection) { echo ' class="selected"'; } ?>>
                        <a href="<?php echo new_connection_url(); ?>">
                            <img src="<?php echo interface_url('/img/add_tab.png'); ?>" alt="<?php echo $this->lang->line('add_tab'); ?>" title="<?php echo $this->lang->line('add_tab'); ?>" />
                        </a>
                    </li>
                </ul>

                <?php if(count($connections) > 0) : ?>
                    <a href="<?php echo logout_url(); ?>" id="logout_url" title="<?php echo $this->lang->line('logout_site'); ?>">
                    </a>
                <?php endif; ?>
            </div>
            
        </div>

        {* Place the page content *}
        <div id="content_wrapper">{$content}</div>

        {* Page footer *}
        <div id="footer_wrapper">
            <div id="footer_version">
                <a href="<?php echo $this->config->item('parent_url'); ?>" target="_blank"><?php echo $this->lang->line('vanilla_version', array('%v' => $this->config->item('vdb_version'), '%s' => $this->config->item('site_name'))); ?></a>
                
                <span id="total_elapsed_time"><?php echo $this->lang->line('elapsed_time'); ?> {elapsed_time} <?php echo strtolower($this->lang->line('date_seconds')); ?></span>
            </div>

            <div id="footer_copyright">
                <?php echo $this->lang->line('licence', array('%s' => $this->config->item('site_name'), '%d' => date('Y'), '%u' => 'http://www.gnu.org/copyleft/gpl.html')); ?>
            </div>

            <?php if(count($browsers) > 0 || !is_null($lang_form)) : ?>
                <ul id="browsers_wrapper">
                    <?php if(!is_null($lang_form)) : ?>
                        <li id="change_lang_wrapper">
                            <?php echo output_form(array('fields' => $lang_form, 'show_required' => false, 'end' => false)); ?>
                            <noscript><?php echo output_form(array('show_required' => false, 'start' => false)); ?></noscript>
                        </li>
                    <?php endif; ?>
                        
                    <li id="works_with_browser"><?php echo $this->lang->line('works_with_browser'); ?></li>
                    <?php foreach($browsers as $browser) : ?>
                        <li>
                            <a href="<?php echo $browser['url'] ?>" target="_blank" class="browser_icon"><img
                                    src="<?php echo interface_url($browser['icon'], 'img'); ?>"
                                    alt="<?php echo $browser['name']; echo !empty($browser['version']) ? ' '.$browser['version'] : ''; ?>"
                                    title="<?php echo $browser['name']; echo !empty($browser['version']) ? ' '.$browser['version'] : ''; ?>" /></a>
                        </li>
                    <?php endforeach; ?>
                </ul>
            <?php endif;?>
        </div>

        <div id="_loading">
            <div class="img">
                <img src="<?php echo interface_url('/img/ajax-loader.gif'); ?>" alt="" />
            </div>
        </div>
        
        <?php echo output_js_lang(); ?>
        
    </body>
</html>